package com.heimali.happyreader.config;

import android.content.Context;
import android.content.SharedPreferences;

import com.heimali.happyreader.HappyReaderApplication;
import com.heimali.happyreader.Statics;

public class PersonalConfig extends BaseConfig {
	protected static SharedPreferences sp = null;
	public static PersonalConfig handle = null;

	@Override
	protected String getSPKey() {
		return Statics.getUid() + "_config";
	}

	@Override
	protected SharedPreferences getSP() {
		return sp;
	}

	protected PersonalConfig() {
		super();
		sp = HappyReaderApplication.getApplication().getSharedPreferences(getSPKey(), Context.MODE_PRIVATE);
	}

	public static PersonalConfig getInstance() {
		if (handle == null) {
			handle = new PersonalConfig();
		}
		return handle;
	}

	public static PersonalConfig renewInstance() {
		destroyInstance();
		return getInstance();
	}

	public static void destroyInstance() {
		handle = null;
	}

}
